package com.lc.pianostudent.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import com.lc.pianostudent.BaseApplication;
import com.lc.pianostudent.R;
import com.lc.pianostudent.dialog.ToastDialog;
import com.zcx.helper.bound.BoundView;

/**
 * Created by Administrator on 2018/6/25.
 */

public class SettingActivity extends BaseActivity implements View.OnClickListener{

    @BoundView(value = R.id.change_pass_layout,isClick = true) private LinearLayout change_pass_layout;
    @BoundView(value = R.id.change_teacher_layout,isClick = true) private LinearLayout change_teacher_layout;
    @BoundView(value = R.id.exit_login,isClick = true) private LinearLayout exit_login;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        setBackTrue();

        initView();
    }

    private void initView(){
        setTitleName("设置");
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.change_pass_layout:
                startVerifyActivity(ChangePassActivity.class);
                break;

            case R.id.change_teacher_layout:
                startVerifyActivity(ChangeTeacherActivity.class);
                break;

            case R.id.exit_login:

                new ToastDialog(this, R.layout.dialog_exit_login){


                    @Override
                    public void cancel() {
                        dismiss();
                    }

                    @Override
                    public void confirm() {
                        BaseApplication.BasePreferences.setIsLogin(false);
                        finish();

                        if (NavigationActivity.onClickProduct != null) {
                            NavigationActivity.onClickProduct.setOnClick();
                        }
                    }
                }.show();

                break;
        }
    }
}
